import { defineConfig } from 'vitepress'
import mdItCustomAttrs from "markdown-it-custom-attrs";
// https://vitepress.dev/reference/site-config
export default defineConfig({
  title: "宗强的技术手册",
  description: "A VitePress Site",
  lastUpdated: true, // 更新时间
  markdown: {
    toc: {
      level: [1, 2, 3, 4, 5]
    },
    image: {
      // 图片懒加载
      lazyLoading: true
    },
    config: (md) => {
      md.use(mdItCustomAttrs, "image", {
        "data-fancybox": "gallery",
      });
    },
    lineNumbers: true, // 显示行号
  },
  themeConfig: {
    // https://vitepress.dev/reference/default-theme-config
    nav: [
      { text: '首页', link: '/' },
      {
        text: '前端',
        items: [
          { text: 'vue框架', link: '/article/vue/' },
          { text: 'react框架', link: '/article/react/' },
          { text: '低代码', link: '/article/low-code/' },
          { text: '微前端', link: '/article/micro-frontend/' },
          { text: 'javascript', link: '/article/javascript/' },
          { text: 'typescript', link: '/article/typescript/' },
          { text: '面试相关', link: '/article/other/08-前端' },
        ]
      },
      {
        text: '后端',
        items: [
          { text: 'node开发', link: '/article/nodeJs/' },
        ]
      },
      {
        text: '移动端',
        items: [
          { text: '微信小程序开发', link: '/article/weChat-miniProgram/' },
          { text: 'uniapp开发', link: '/article/uni-app/' },
          { text: '鸿蒙开发', link: '/article/harmonyOS/' }
        ]
      },
      {
        text: '嵌入式',
        items: [
          { text: 'C语言', link: '/article/weChat-miniProgram/' },
        ]
      },
      { text: '其它', link: '/article/other/' }
    ],
    sidebar: {
      '/article/vue/': [
        {
          text: 'vue2框架',
          items: [
            { text: '简介', link: '/article/vue/vue2/' },
            { text: '框架常用api介绍', link: '/article/vue/vue2/api/01' },
            { 
              text: '实战',
              items: [
                { text: 'vue2+elementUI搭建web页面', link: '/article/vue/vue2/practice/02' }
              ]
            },
            {
              text: '其它',
              items: [
                {
                  text: '路由器的工作模式',
                  link: '/article/vue/vue2/practice/03'
                },
                {
                  text: '配置跨域',
                  link: '/article/vue/vue2/practice/04'
                },
                {
                  text: '1-封装axios',
                  link: '/article/vue/vue2/practice/05'
                },
                {
                  text: '2-封装axios2',
                  link: '/article/vue/vue2/practice/06'
                },
              ]
            }
          ]
        },
        {
          text: 'vue3框架',
          items: [
            { text: '简介', link: '/article/vue/vue3/' },
            { text: '框架常用api介绍', link: '/article/vue/vue3/api/01' },
            {
              text: '实战',
              items: [
                { text: 'vue3+elementPlus+ts项目实战1', link: '/article/vue/vue3/practice/01'},
                { text: 'vue3+elementPlus+ts项目实战2', link: '/article/vue/vue3/practice/02'}
              ]
            },
            {
              text: '其它',
              items: [
                { text: '问题1', link: '/article/vue/vue3/problem/01' }
              ]
            }
          ]
        }
      ],
      '/article/react/': [
        {
          text: 'react框架',
          items: [
            { text: '简介', link: '/article/react/' },
            { text: '框架常用api介绍1', link: '/article/react/api/01' },
            { text: '框架常用api介绍2', link: '/article/react/api/02' },
            { text: '框架常用api介绍3', link: '/article/react/api/03' },
            { text: 'react18使用', link: '/article/react/api/04' },
            {
              text: '实战',
              items: [
                { text: '从0到1搭建react项目', link: '/article/react/practice/01' }
              ]
            },
            {
              text: '其它',
              items: [
                { text: '其它', link: '/article/react/problem/01' }
              ]
            }
          ]
        },
      ],
      '/article/javascript/': [
        {
          text: 'javascript基础',
          items: [
            { text: '简介', link: '/article/javascript/' },
            { text: '基础API的使用', link: '/article/javascript/api/01' },
            {
              text: '实战',
              items: [
                { text: '常用方法', link: '/article/javascript/practice/01' },
                { text: '生产环境常用依赖', link: '/article/javascript/practice/02' },
                { text: '开发环境常用依赖', link: '/article/javascript/practice/03' }
              ]
            }
          ]
        }
      ],
      '/article/nodeJs/': [
        {
          text: 'node开发',
          items: [
            { text: '简介', link: '/article/nodeJs/' },
            { text: '基础API的使用', link: '/article/nodeJs/api/01' }
          ]
        },
        {
          text: 'express框架使用',
          items: [
            { text: '框架实战', link: '/article/nodeJs/practice/framework/express/01' }
          ]
        }
      ],
      '/article/weChat-miniProgram/': [
        {
          text: '微信小程序开发',
          items: [
            { text: '简介', link: '/article/weChat-miniProgram/' },
            { text: '基础API的使用', link: '/article/weChat-miniProgram/api/01' }
          ]
        },
      ],
      '/article/uni-app/': [
        { text: '简介', link: '/article/uni-app/' },
        {
          text: '实战',
          items: [
            { text: 'uniapp+vue3+ts', link: '/article/uni-app/practice/01' },
            { text: '实战一个壁纸app', link: '/article/uni-app/practice/02' },
            { text: 'uniapp开发总结', link: '/article/uni-app/practice/03' },
          ]
        },
      ],
      '/article/cProgram/': [
        {
          text: 'C语言',
          items: [
            { text: '简介', link: '/article/cProgram/' },
            { text: '基础API的使用', link: '/article/cProgram/api/01' }
          ]
        },
      ],
      '/article/other/': [
        {
              text: '其它',
              items: [
                { text: '简介', link: '/article/other/' },
                { text: 'git常用命令', link: '/article/other/01-git/01' },
                { text: 'Linux常用命令', link: '/article/other/04-服务器/02' },
                { text: '前端开发规范', link: '/article/other/02-前端开发规范/01' },
                { text: 'vue开发规范', link: '/article/other/03-vue开发规范/01' },
                { text: '代码管理规范', link: '/article/other/07-代码管理规范/01.md'},
                { text: 'vitePress+阿里云部署个人网站', link: '/article/other/04-服务器/01' },
                { text: '技术的概览', link: '/article/other/06-技术概览/01' },
              ]
            },
      ],
      '/article/other/08-前端/': [
        {
          text: '面试知识点',
          items: [
            { text: '面试技巧', link: '/article/other/08-前端/' },
            { text: '前端面试题', link: '/article/other/08-前端/01' },
          ]
        }
      ],
      '/article/harmonyOS/': [
        {
          text: '笔记',
          items: [
            { text: '实战笔记1', link: '/article/harmonyOS/api/01' },
            { text: '实战笔记2', link: '/article/harmonyOS/api/02' },
            { text: '实战笔记3', link: '/article/harmonyOS/api/03' }
          ]
        }
      ],
    },
    // sidebar: [
    //   {
    //     text: 'Examples',
    //     items: [
    //       { text: 'Markdown Examples', link: '/markdown-examples1' },
    //       { text: 'Runtime API Examples', link: '/api-examples' }
    //     ]
    //   },
    // ],
    socialLinks: [
      { icon: 'github', link: 'https://github.com/vuejs/vitepress' }
    ],
    search: {
      provider: 'local'
    },
    // 文章显示的大纲级别
    // 值是number或array或object或object，为number是，例如outline: 3，表示只显示3级标题，outline: [2, 6]表示2-6级都显示
    // outline: [2, 6], // 2/[2, 6]/'deep'/{}
    outline: {
      level: [2, 4],
      label: '当前页', // 替换页面显示的On this page
    },
    // aside: 'left', // 大纲显示的位置
    docFooter: { prev: '上一篇', next: '下一篇'},
    // footer: {
    //   message: 'Released under the <a href="https://vitepress.dev/zh/guide/what-is-vitepress">基于vitePress搭建</a>.',
    //   copyright: 'Copyright © 2019-<a href="https://gitee.com/zong__qiang">宗强的博客</a>'
    // }
  },
  head:[
    ['link', { rel: 'icon', href: '/favicon.ico'}],
    ["link", { rel: "stylesheet", href: "https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.css" }],
    ["script", { src: "https://cdn.jsdelivr.net/npm/@fancyapps/ui@4.0/dist/fancybox.umd.js" }],
  ],
  // vite底层配置
  vite: {
    server: {
      port: 5180,
      strictPort: false,
    },
    build: {
      chunkSizeWarningLimit: 1000 // 单文件最大打包限制为1000kb，默认是500kb
    }
  }
})
